<?php
// .-----------------------------------------------------------------------------------
// |  Software: [HDPHP framework]
// |   Version: 2013.01
// |      Site: http://www.hdphp.com
// |-----------------------------------------------------------------------------------
// |    Author: 向军 <houdunwangxj@gmail.com>
// | Copyright (c) 2012-2013, http://houdunwang.com. All Rights Reserved.
// |-----------------------------------------------------------------------------------
// |   License: http://www.apache.org/licenses/LICENSE-2.0
// '-----------------------------------------------------------------------------------
class IndexControl extends checkLogin{
    //后台主页
    function index(){
 	    $db = M('menu');
        $result = $db->where('pid=0')->field('id,name')->findall();

        $uname = $_SESSION['ica_uname'];
        
        //分配变量
        $this->assign('uname',$uname); //管理员名称
        $this->assign('menu',$result); //顶级菜单
 		$this->display();
    }

    //异步删除缓存
    function ajaxDelCache(){
        $status = $_POST['status'];
        $result = 0;
        if($status=='del'){//参数为del，进行删除
            $dirname = PATH_ROOT."/temp";
            if(dir::del_son($dirname)){
                $result=1;
            }

        }

        echo json_encode(array('status'=>$result));
    }
        //异步取得菜单
    function ajaxMenu() {

        $db = M('menu');
        $result = $db->where('pid = ' . $_GET['pid'])->field('id,name')->findall();
        foreach ($result as $k => $v) {
            $result[$k]['child'] = $db->where('pid = ' . $v['id'])->field('id,name,app,control,action')->findall();
        }
        

        $this->assign('menu', $result);
        $this->display();
    }


    //登录页面
    function login(){
        
        $this->display();
    }
   
    function copy(){
        $this->display();
    }



    //add
    function add(){
        $this->display();
    }
    function post(){
    	$con = $_POST['con'];
    	P($con);
    }
    function up(){
    	echo "up方法";
    	var_dump($_POST);
        var_dump($_SESSION);
    }
    function upload1(){
        if(!isset($_FILES)){
            die('wrong');
        }
        p($_FILES['file1']);
    }
}
?>